using System;
using System.Collections.Generic;
using System.Linq;

namespace Sustainalytics.ESGRatings.Computing.Entities
{
    public class CompanyScores : CompanyIndicators<IndicatorScore>
    {
        public CompanyScores(Guid companyId, IEnumerable<IndicatorDefaultScore> indicatorDefaultScores)
        {
            IndicatorsData = indicatorDefaultScores;
            CompanyId = companyId;
        }

        public Rating OverallScore { get; set; }

        public Rating EnvironmentScore { get; set; }

        public Rating SocialScore { get; set; }

        public Rating GovernanceScore { get; set; }

        public Rating PreparednessScore { get; set; }

        public Rating DisclosureScore { get; set; }

        public Rating QualitativePerformanceScore { get; set; }

        public Rating QuantitativePerformanceScore { get; set; }

        public CompanyScores FilterdIndicators(HashSet<string> indicatorCodes)
        {

            IndicatorsData = IndicatorsData.Where(it => indicatorCodes.Contains(it.Code)).Select(x => new IndicatorDefaultScore(x.Code, x.Value));
            return this;
        }
    }


    public class Rating
    {
        public float Score { get; set; }

        public float Weight { get; set; }

        public Rating(float score, float weight)
        {
            Score = score;
            Weight = weight;
        }
    }
}